package hu.tortavar2.client.view.adminpages;

import com.google.gwt.core.client.GWT;
import com.google.gwt.core.client.Scheduler.ScheduledCommand;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.HTMLPanel;
import com.google.gwt.user.client.ui.MenuItem;
import com.google.gwt.user.client.ui.Widget;

public class AdminMainPage extends Composite {

	private static AdminMainPageUiBinder uiBinder = GWT
			.create(AdminMainPageUiBinder.class);

	interface AdminMainPageUiBinder extends UiBinder<Widget, AdminMainPage> {
	}

	public AdminMainPage() {
		initWidget(uiBinder.createAndBindUi(this));
		setMenu();
	}

	@UiField MenuItem addProduct;
	@UiField MenuItem addImage;
	@UiField HTMLPanel contentPanel;
	
	private void setMenu() {
		addProduct.setScheduledCommand(new ScheduledCommand() {
			
			@Override
			public void execute() {
				contentPanel.clear();
				contentPanel.add(new AdminMainPage_AddProduct());
			}
		});
		
		addImage.setScheduledCommand(new ScheduledCommand() {
			
			@Override
			public void execute() {
				contentPanel.clear();
				contentPanel.add(new AdminMainPage_AddImage());
			}
		});
	}
	
	
}
